package de.hwr.sudokuspielehr.ui;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

@SuppressWarnings("serial")
public class HelperFrame extends JFrame {

	private static final Dimension WND_SIZE = new Dimension(400, 500);
	private static final Dimension IMG_SIZE = new Dimension(239, 220);

	/**
	 * 
	 * @param pText
	 */
	public HelperFrame(List<String> pText, String pTitle, String pImagePath) {

		int initialy = 65;
		int i = 0;
		int padding = 0;
		int labelHeight = 20;
		Font f = new Font("Sans Serif", 0, 12);
		Font fheading = new Font("Sans Serif", 1, 16);

		JLabel heading = new JLabel(pTitle);
		heading.setFont(fheading);
		heading.setSize(new Dimension(400, 25));
		heading.setLocation(50, 20);
		add(heading);

		for (String s : pText) {
			int y = initialy + i * (padding + labelHeight);
			JLabel currentLabel = new JLabel(s);
			currentLabel.setSize(new Dimension(400, labelHeight));
			currentLabel.setFont(f);
			currentLabel.setLocation(50, y);
			add(currentLabel);
			i++;
		}

		ImageIcon scan = new ImageIcon(pImagePath);
		JLabel asd = new JLabel(scan);
		asd.setSize(IMG_SIZE);
		asd.setLocation(new Point(70, 220));
		add(asd);

		setLayout(null);
		setResizable(false);
		setTitle("Hilfe - " + pTitle);
		setSize(WND_SIZE);
		setLocation(300, 100);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setVisible(true);
	}
}
